package zcx;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.02.09.15.30
 */
public class ApleTetx {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        var a=Apple.class;
        Method m=a.getMethod("setPrice", int.class);
        //System.out.println(m.getName());
        var a2=a.getConstructor().newInstance();
        m.invoke(a2,16);
        var mget=a.getMethod("getPrice");
        Object p=mget.invoke(a2);
        System.out.println(p);
    }
}
